﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Dashboard
{
    public partial class SettingForm : Form
    {
        UC_SerialPortl serialPortl;
        UC_Dashboard dashboard;
        UC_Test test;
        public SettingForm()
        {
            InitializeComponent();

            this.StartPosition = FormStartPosition.CenterScreen;
            serialPortl = new UC_SerialPortl();
            serialPortl.Location = new Point(6, 20);
            dashboard = new UC_Dashboard();
            dashboard.Location = new Point(6, 20);
            test = new UC_Test();
            test.Location = new Point(6, 20);


        }
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            String tag = treeView1.SelectedNode.Text;
            Console.WriteLine(tag);
            this.groupBox1.Controls.Clear();
            switch (tag)
            {
                case "串口设置":
                    this.groupBox1.Controls.Add(serialPortl);
                    this.groupBox1.Text = "串口设置";
                    break;
                case "显示设置":
                    this.groupBox1.Text = "显示设置";
                    this.groupBox1.Controls.Add(dashboard);
                    break;
                case "测试":
                    this.groupBox1.Text = "测试";
                    this.groupBox1.Controls.Add(test);
                    break;
                default:
                    this.groupBox1.Controls.Add(serialPortl);
                    this.groupBox1.Text = "串口设置";
                    break;
            }

        }
    }
}
